#include <ros/ros.h>
#include <study2/mysrv.h>

int main(int argc, char **argv) noexcept {
    ros::init(argc, argv, "client");
    ros::NodeHandle node_handle;

    ros::service::waitForService("/spawn");
    ros::ServiceClient client = node_handle.serviceClient<study2::mysrv>("/spawn");

    study2::mysrv request;
    request.request.name = "my_spawn";
    request.request.age = 2;

    if (client.call(request)) {
        ROS_INFO("Turtle spawned with name %s", request.response.name.c_str());
    } else {
        ROS_ERROR("Failed to call service /spawn");
        return 1;
    }

    return 0;
}
